from ctypes import *
import sys
module_path = sys.path[0] 
libpath=module_path+"/bin/libul.so"
ullib = cdll.LoadLibrary(libpath)
prototype = CFUNCTYPE(c_int,c_int,c_int)
prototype1 = CFUNCTYPE(c_double,c_int)
# ---(p,t) ----------------
def ul_init(trigger, echo):
   f=prototype(("ul_init", ullib),)
   f(trigger, echo) 

def ul_distanc(timeout):
    f=prototype1(("ul_distance", ullib),)
    return f(timeout)

ul_init(15,14)
for _ in range(1000):
   distance=ul_distanc(10000)
   print("distance:", distance)
